#include <iostream>
#include "antlr4-runtime.h"
#include "MySqlLexer.h"
#include "MySqlParser.h"
#include "ExeVisitor.h"

#pragma execution_character_set("utf-8")
using namespace antlr4;
using namespace antlrcpptest;

int main(int argc, const char* argv[]){
    ANTLRInputStream input(std::cin);
    MySqlLexer lexer(&input);

    CommonTokenStream tokens(&lexer);

    tokens.fill();
    for (auto token : tokens.getTokens()) {
         std::cout << token->toString() << std::endl;
     }

    MySqlParser parser(&tokens);
    tree::ParseTree* tree = parser.root(); //root就是语法文件的起始规则名称

    ExeVisitor eval; //实例化自定义的访问器类
    eval.visit(tree); //通过visit()函数开始遍历语法树 

    return 0;
}
